
/* -----------------
* brief 
* 1. this is code gen by tools 
* 2. array like [a,b,c] after each field, define the ui html tag in view, 
		a for title, 
		b for show or not , (onlyread is trial feature)
		c for element html tag , currently support : check、radio、select、input、textarea、upload
* 3. XXX
*/
//go:generate legogen -type=MchCoupon -kv=ModuleName=coupon,PrjName=saas_sys_base -dirconf=../../.. ./MchCoupon.go

/*使用方法一(go generate)：在工程root目录下，执行go generate ./modules/coupon/models

使用方法二(legogen)：直接调用生成命令
legogen -type=MchCoupon -kv=ModuleName=coupon,PrjName=saas_sys_base -dirconf=./. ./modules/coupon/models/MchCoupon.go
*/

package coupon
import (
	"github.com/chanxuehong/wechat/mchv3/marketing/busifavor"
	"github.com/mjiulee/lego"
	"saas_sys_base/common"
)

func init() {
	lego.AddBeanToSynList(new(MchCoupon))
}

/* table: "tb_mch_coupon"
 * -----------------
*/
type MchCoupon struct {
	Id        int64  `xorm:"pk" json:",string"`                  // ["id","hide","hidden"]
	IfDel     int `xorm:"default 0"` // ["deleted","hide","hidden"]
	Cdate     string `xorm:"DateTime created"`    // ["create","show","datetime"]
	Udate     string `xorm:"DateTime updated"`    // ["update","show","datetime"]
    // add your custom field here
	//TenantId int64 `xorm:""`    // ["TenantId","onlyread","datetime"]
	common.Who `xorm:"extends"`

	CouponMode common.COUPON_MODE   // ["CouponMode","onlyread","datetime"]
	busifavor.MchCoupon `xorm:"extends"`
	*busifavor.CreateBusiFavorStockResp `xorm:"extends"` // TODO这里结构名字要改一下
	Status int  // ["状态","show","datetime"]
}

func NewMchCoupon(who *common.Who, mchcoupon *busifavor.MchCoupon, couponmode common.COUPON_MODE) *MchCoupon {
	mchCoupon := new(MchCoupon)
	mchCoupon.Who = *who
	mchCoupon.CouponMode = couponmode
	mchCoupon.MchCoupon = *mchcoupon
	return mchCoupon
}